home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 142 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.std.c
  4. Subject: Re: atexit() and return from main()
  5. Date: 18 Jan 1996 15:40:25 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Jan18084025@qcd.lanl.gov>
  8. References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk>
  9.     <821923074snz@genesis.demon.co.uk> <4dkvjk$6q5@lyra.csx.cam.ac.uk>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: nmm1@cus.cam.ac.uk's message of 18 Jan 1996 08:15:48 GMT
  14.  
  15. --text follows this line--
  16. In article <4dkvjk$6q5@lyra.csx.cam.ac.uk> nmm1@cus.cam.ac.uk (Nick
  17. Maclaren) writes: 
  18. <snip>
  19.    But you are making a serious mistake in assuming that run-time systems
  20.    can be implemented to allow everything that the standard permits by
  21.    omission.  They can't.  In THIS case, they can usually preserve the
  22.    stack before calling the atexit() functions.
  23.  
  24. I think you are bringing up non-issues.
  25.  
  26.    However, for the advanced paper, think about the following problems:
  27.  
  28.    What is the effect of an atexit() function calling exit()?  Does it
  29.    restart the atexit() queue, carry on as if the function had returned
  30.    or does it abandon the atexit() queue?
  31.  
  32.    I chose to do the second, as by far the most user-friendly, but I
  33.    would NEVER write serious code that relied upon that action!
  34.  
  35.    main() calls setjmp() and then calls exit().  An atexit() function
  36.    calls longjmp() and returns to main().  This repeats (or does it?)
  37.  
  38.    This is ALSO permitted by omission, but a good run-time system will
  39.    trap it, issue an error message and stop without calling more atexit()
  40.    functions.
  41.  
  42. Neither of these is permitted in any sense that I understand!
  43. 7.10.4.3: If more than one call to the exit function is executed by
  44. a program, the behaviour is undefined. No `permission by omission'
  45. that I can see.
  46.  
  47. Cheers
  48. Tanmoy
  49. --
  50. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  51. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  52. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  53. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  54. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  55. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  56.